package com.yazi.mxz.common.db.dao.impl;



import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.yazi.mxz.common.db.dao.PrizeDao;
import com.yazi.mxz.common.entity.beans.Prize;

import com.myframework.smhj.hibernate.dao.BasicDao;

@Repository("prizeDao")
public class PrizeDaoImpl extends BasicDao<Prize> implements PrizeDao {

	
	public PrizeDaoImpl() {
		super(Prize.class);
		
	}

	@Override
	public Criteria getExample(Prize prize, String searchWord) {
		Criteria c = super.getExample(prize, searchWord);
		
		// ...关联对象条件
		
		// 关键字条件
		if (null != searchWord && !searchWord.isEmpty()) {
			//关键字查询
			String likeWord = "%" + searchWord + "%";
			c.add(Restrictions.or(Restrictions.like("name", likeWord)));
		}
		
		return c;
	}
	
}
